
<template>
  <div class="h100 p10" style="background:#4a4b5c;">
    <div class="wrapper h100 rel o-hide">
      <div v-if="orderList">
        <div
          class="w100 bg-white r-5 p15 round"
          style="margin-bottom:10px;"
          v-for="(item,index) in orderList"
          :key="index"
        >
          <div>
            <p class="f j-b p10 pt0">
              <b class="f18">
                6号桌
                <em class="t3 f13 normal ml10">在店就餐</em>
                <em class="t3 f13 normal ml10">153****8355</em>
              </b>
              <em class="f13 t3">6分钟前</em>
            </p>
            <van-cell-group>
              <van-cell
                @click="openOptionmenu = true"
                title="酸辣土豆丝"
                value-class="b w100"
                value="×2"
                label="加辣 / 米饭加量 / 不加香菜"
              />
              <van-cell title="" label="备注:老板快点出菜，我赶飞机！"/>
            </van-cell-group>
          </div>
          <div class="f j-a w100">
            <van-button type="primary" round block class="m10" @click="confirmOrder">全部出单</van-button>
            <van-button type="warning" round block class="m10" @click="cancelOrder">取消订单</van-button>
          </div>
        </div>
      </div>
      
      <no-data class="h100 f j-c a-c p20 rotateInDownLeft animated" v-else :title="'暂无新订单'" />

    </div>
    <option-menu
      :show="openOptionmenu"
      :title="'你要对该商品做什么？'"
      :buttons="['出单','退款']"
      :animation="'flipInX'"
      @func="getMsgFormSon"
    />
  </div>
</template>

<script>
import BScroll from "better-scroll";
import OptionMenu from "./../components/optionmenu";
import NoData from "./../components/nodata";
export default {
  components: {
    OptionMenu,NoData
  },
  data() {
    return {
      orderList:10,
      active2: 0,
      roll: "",

      openOptionmenu: false
    };
  },
  created() {},
  mounted() {
    this.roll = new BScroll(".wrapper", {
      probeType: 2,
      click: true
    });
    // this.roll.on("scroll", function(option) {
    //   console.log(option);
    // });
  },
  methods: {
    onTab() {
      this.roll.refresh();
    },

    getMsgFormSon(data) {
      this.openOptionmenu = false;
      console.log(data);
    },


    confirmOrder(){
      this.$toast.success('已出单');
    },

    cancelOrder() {
      this.$dialog.confirm({
        title: "确定要取消订单吗",
        message: "取消订单后，金额会全额退还至用户钱包"
      })
        .then(() => {
          // on confirm
        })
        .catch(() => {
          // on cancel
        });
    }
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>
